package com.cxyjy.cfyuiapi.controller;

import com.cxyjy.cfyuiapi.service.HomeService;
import com.cxyjy.common.util.JResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: jony
 * @Date : 2024/11/8 10:32
 * @VERSION v1.0
 */

@Controller
public class HomeController {
    @Autowired
    HomeService homeService;
    @RequestMapping("/")
    public String home(){
        // 返回视图名，Spring Boot会在resources/templates目录下查找对应的模板文件
        return "appDemo.html";
    }

    /**
     * 检查验证码
     * 验证码写死在代码里
     * @param verificationCode
     * @return
     */
    @PostMapping("/checkVerificationCode")
    @ResponseBody
    public JResponse checkVerificationCode(String verificationCode){
        return homeService.checkVerificationCode(verificationCode);
    }
}
